package com.bobi.tfca.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bobi.tfca.dao.RoleDao;
import com.bobi.tfca.model.entity.RoleEntity;
import com.bobi.tfca.service.RoleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 角色服务层实现
 * @author 李文发
 * @date 2024/4/3
 */
@Service
@Slf4j
public class RoleServiceImpl extends ServiceImpl<RoleDao, RoleEntity> implements RoleService {
    @Override
    public List<RoleEntity> getLessLevelRole(Integer roleId) {
        RoleEntity role = this.getById(roleId);
        Integer level = role.getLevel();
        List<RoleEntity> list = this.list(new LambdaQueryWrapper<RoleEntity>().le(RoleEntity::getLevel, level));
        return list;
    }
}
